package com.geintech.learnobj;

import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.concurrent.TimeUnit;

@Controller
@RequestMapping("/redis")
public class RedisUpdController {

    @Resource
    private RedisTemplate redisTemplate;


    @GetMapping("/genKey")
    public boolean genKey() {
        boolean  ok = redisTemplate.opsForValue().setIfAbsent("myconfig", "this is my config",10000, TimeUnit.SECONDS);
        return ok;
    }


}
